<template>
  <div class="app-container">
    <el-tabs type="border-card">
      <el-tab-pane label="回款" :lazy="islazy">
        <CashPane></CashPane>
      </el-tab-pane>
      <el-tab-pane label="推荐" :lazy="islazy" >
        <CvPane></CvPane>
      </el-tab-pane>
      <el-tab-pane label="Offer" :lazy="islazy">
        <OfferPane></OfferPane>
      </el-tab-pane>
      <el-tab-pane label="入职" :lazy="islazy">
        <BoardingPane></BoardingPane>
      </el-tab-pane>
      <el-tab-pane label="新增客户" :lazy="islazy">
        <NewClientPane></NewClientPane>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>


<script>
import BoardingPane from '@/views/dashboard/components/pane/boardingAnalysisPane'
import CashPane from '@/views/dashboard/components/pane/cashAnalysisPane'
import CvPane from '@/views/dashboard/components/pane/cvAnalysisPane'
import NewClientPane from '@/views/dashboard/components/pane/newClientAnalysisPane'
import OfferPane from '@/views/dashboard/components/pane/offerAnalysisPane'
import moment from 'moment'
export default {
  name: 'analysis',
  components: {
    BoardingPane,
    CashPane,
    CvPane,
    NewClientPane,
    OfferPane
  },
  data() {
    return {
      islazy: true,
      // to= moment(日期).endOf(‘month‘).format("YYYY-MM-DD")+" 23:59:59";
      pickerOptions: {
        shortcuts: [{
          text: '今日',
          onClick(picker) {
            const end_str = moment().format('YYYY-MM-DD') + ' 23:59:59'
            const end = moment(end_str, 'YYYY-MM-DD HH:mm:ss')
            const start_str = moment().format('YYYY-MM-DD') + ' 00:00:00'
            const start = moment(start_str, 'YYYY-MM-DD HH:mm:ss')
            picker.$emit('pick', [start, end])
          }
        }, {
          text: '本周',
          onClick(picker) {
            const end_str = moment().day(7).format('YYYY-MM-DD') + ' 23:59:59'
            const end = moment(end_str, 'YYYY-MM-DD HH:mm:ss')
            const start_str = moment().day(1).format('YYYY-MM-DD') + ' 00:00:00'
            const start = moment(start_str, 'YYYY-MM-DD HH:mm:ss')
            picker.$emit('pick', [start, end])
          }
        }, {
          text: '本月',
          onClick(picker) {
            const end_str = moment().endOf('month').format('YYYY-MM-DD') + ' 23:59:59'
            const end = moment(end_str, 'YYYY-MM-DD HH:mm:ss')
            const start_str = moment().startOf('month').format('YYYY-MM-DD') + ' 00:00:00'
            const start = moment(start_str, 'YYYY-MM-DD HH:mm:ss')
            console.log(start_str, end_str)
            picker.$emit('pick', [start, end])
          }
        }, {
          text: '全年',
          onClick(picker) {
            const end_str = moment().endOf('year').format('YYYY-MM-DD') + ' 23:59:59'
            const end = moment(end_str, 'YYYY-MM-DD HH:mm:ss')
            const start_str = moment().startOf('year').format('YYYY-MM-DD') + ' 00:00:00'
            const start = moment(start_str, 'YYYY-MM-DD HH:mm:ss')
            console.log(start_str, end_str)
            picker.$emit('pick', [start, end])
          }
        }]
      },
      data_group: [moment(moment().format('YYYY-MM-DD') + ' 00:00:00', 'YYYY-MM-DD HH:mm:ss'), moment(moment().format('YYYY-MM-DD') + ' 23:59:59', 'YYYY-MM-DD HH:mm:ss')]
    }
  },
  methods: {
  }
}
</script>

<style rel="stylesheet/scss" lang="scss" scoped>
.app-container {
  margin: 4px 4px 0px 4px;
  padding: 0px;
}
.date-container {
  display: flex;
  justify-content: flex-end;
  margin: 0px 2px 4px 0px;
}
</style>
